// dfs
function dfs(root: any, callback: (arg0: any) => void) {
  const stack = [root];
  while (stack.length) {
    const node = stack.pop();
    callback(node);
    node.children.forEach((child: any) => stack.push(child));
  }
}
